<?php
class Page extends SiteTree {

	public static $db = array(
	);

	public static $has_one = array(
	);

}
class MySearchForm extends Form {
 
   function __construct($controller, $name) {
      $fields = new FieldSet(
         new TextField('name')
      );
 
      $actions = new FieldSet(
         new FormAction('searchresult')
      );
 
      parent::__construct($controller, $name, $fields, $actions);
   }
 
   function forTemplate() {
      return $this->renderWith(array(
         $this->class,
         'Form'
      ));
   }
 
      function searchresult($data, $form){
     $data = array(
            'Results' => $form->getResults(),
            'Query' => $form->getSearchQuery(),
            'Title' => 'Search Results'
        );
        $this->Query = $form->getSearchQuery();
     
        return $this->customise($data)->renderWith(array('Page_searchresult', 'Page'));
    
        }
  
}
class Page_Controller extends ContentController {

	
     
         function SearchFormCustom()
        {
            return new MySearchForm($this, 'SearchFormCustom');
        }
         function getNewInformaton()
        {
            $new= DataObject::get('NewInformation','','Date DESC', '', 5);
            $doSet = new DataObjectSet();
            foreach ($new as $data)
            {
                $date=$data->Date;
                $titile=$data->Titile;
                $record=array(
                   "Date"=>$date,
                  "Titile"=>$titile
                );
                $doSet->push(new ArrayData($record));
            }
            return $doSet;
        }
}